package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum UserSexType {
	
	UNKNOWN(0,"未知"),
	MAN(1,"男性"),
	WOMAN(2,"女性");
	
	private Integer value;
	private String text;

	private UserSexType(Integer value,String text) {
		this.value = value;
		this.text = text;
	}

	public int toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}

	public static UserSexType toTypeLevel(int value) {
		if (MAN.value == value) {
			return MAN;
		} else if (WOMAN.value == value) {
			return WOMAN;
		}else if (UNKNOWN.value == value) {
			return UNKNOWN;
		}else {
			throw new InvalidArgumentException("Unknown UserSexType[" + value + "].");
		}
	}
}
